const express = require('express');
const app = express();

// 编写中间件用于处理/login路径的POST请求
app.post('/login', (req, res, next) => {
  
  //res.end('登录成功，欢迎回来~');

 
  res.json({
    code: 0,
    message: '欢迎回来~',
    list: [
      { name: 'iPhone', price: 111 },
      { name: 'iPad', price: 111 },
      { name: 'iMac', price: 111 },
      { name: 'Mac', price: 111 }
    ]
  });
  
// res.status(201); 
  // res.json('创建用户成功~'); 
});

app.listen(9000, () => {
  console.log('Express服务器启动成功~');
});